﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;
using YasharEl.Infrastructure.EntityModel;

namespace YasharEl.Infrastructure.OrgUnit
{
    public class Job : ValueObject<Job>
    {
        #region Fields

        private readonly long _code;
        private readonly string _description;
        private readonly DateTime _jobFrom;
        private readonly DateTime? _jobTo;

        #endregion

        #region Constructors

        private Job()
        {

        }

        public Job(long code, string description, DateTime jobFrom, DateTime? jobTo)
        {
            Contract.Requires<ArgumentNullException>(code > 0, "code must be valid positive number.");
            Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(description), "description could not be null or empty.");

            // TODO : Add job from and to dates assertions

            _code = code;
            _description = description;
            _jobFrom = jobFrom;
            _jobTo = jobTo;
        }

        #endregion

        #region Properties

        public long Code
        {
            get { return _code; }
        }

        public string Description
        {
            get { return _description; }
        }

        public DateTime JobFrom
        {
            get { return _jobFrom; }
        }

        public DateTime? JobTo
        {
            get { return _jobTo; }
        }

        #endregion
    }
}
